package javaScript
{
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	import flash.net.navigateToURL;
	import flash.net.URLRequest;
	import flash.external.ExternalInterface;
	
	import util.SimpleButton;
	
	public class AddFavorite extends Sprite
	{
		private var button:SimpleButton;
		public function AddFavorite()
		{
			super();
			init();
		}
		
		public function init():void {
			button = new SimpleButton("收藏",100);
			this.addChild(button);
			button.x = 100;
			button.y = 100;
			button.addEventListener(MouseEvent.CLICK,onClick);
		}
		
		public function onClick(event:MouseEvent):void {
			navigateToURL(new URLRequest("javascript: window.external.addFavorite('http://www.163.com','网页');"),"_self");
//			navigateToURL(new URLRequest("javascript:window.alert('hello world')"),"_self");
//			var functionContent:String = "if (document.all){alert('hello ie');window.external.addFavorite('www.163.com', '梦想三国');}else if (window.sidebar){window.sidebar.addPanel('梦想三国2', 'www.163.com', '');}";
//			ExternalInterface.call("eval",functionContent);
		}
	}
}